<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Kalip Details</f:facet>

		<rich:layout>
        	<rich:layoutPanel position="left" id="ilkKontrol">

		        <s:decorate id="kod" template="layout/display.xhtml">
		            <ui:define name="label">Kod</ui:define>
		            <h:outputText value="#{kalipHome.instance.kod}"/>
		        </s:decorate>
		
		        <s:decorate id="ad" template="layout/display.xhtml">
		            <ui:define name="label">Ad</ui:define>
		            <h:outputText value="#{kalipHome.instance.ad}"/>
		        </s:decorate>
		
		        <s:decorate id="agirlik" template="layout/display.xhtml">
		            <ui:define name="label">Agirlik</ui:define>
		            <h:outputText value="#{kalipHome.instance.agirlik}"/>
		        </s:decorate>
		
		        <s:decorate id="olcubirimid" template="layout/display.xhtml">
		            <ui:define name="label">Ölçü Birimi</ui:define>
		            <h:outputText value="#{kalipHome.instance.olcubirim.kisaad} - #{kalipHome.instance.olcubirim.ad}"/>
		        </s:decorate> 
		
		        <s:decorate id="setmi" template="layout/display.xhtml">
		            <ui:define name="label">Setmi</ui:define>
		            <h:outputText value="#{kalipHome.instance.setmi ? 'Evet' : 'Hayır'}"/>
		        </s:decorate>
		        
			</rich:layoutPanel>
		    	
			<rich:layoutPanel position="center">
				<s:decorate id="authorizedPeopleField" template="layout/display.xhtml">
					<ui:define name="label">Alt Kalıplar</ui:define>			 
					<rich:dataList var="kalipAltKalipList" value="#{kalipHome.instance.kalipAltKalipList}" rows="5" >
		                <h:outputText value="#{kalipAltKalipList}"/>
		        	</rich:dataList>
				</s:decorate>				
			</rich:layoutPanel>
			
		</rich:layout>


        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/KalipEdit.xhtml"
                    id="edit"
                 value="Edit"/>

        <s:button view="/#{empty kalipFrom ? 'KalipList' : kalipFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab rendered="#{kalipHome.instance.firma == null || authenticator.isAdmin()}">
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>Firma</h:panelGroup>
        </f:facet>
    <div class="association" id="firmaParent">

        <h:outputText value="There is no firma associated with this kalip."
                   rendered="#{kalipHome.instance.firma == null}"/>

        <rich:dataTable var="_firma"
                   value="#{kalipHome.instance.firma}"
                rendered="#{kalipHome.instance.firma != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="firmaTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_firma.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Ad</f:facet>
                <h:outputText value="#{_firma.ad}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Adres</f:facet>
                <h:outputText value="#{_firma.adres}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Eposta</f:facet>
                <h:outputText value="#{_firma.eposta}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Kod</f:facet>
                <h:outputText value="#{_firma.kod}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Mersisno</f:facet>
                <h:outputText value="#{_firma.mersisno}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Telefon</f:facet>
                <h:outputText value="#{_firma.telefon}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Vergino</f:facet>
                <h:outputText value="#{_firma.vergino}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Webadresi</f:facet>
                <h:outputText value="#{_firma.webadresi}"/>
            </h:column>
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewfirma"
                     value="View"
                      view="/Firma.xhtml">
                    <f:param name="firmaId"
                           value="#{_firma.id}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Kalipaltkalips for kalipid</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="kalipAltKalipListChildren">

        <h:outputText value="There are no kalipAltKalipList associated with this kalip."
                   rendered="#{empty kalipHome.kalipAltKalipList}"/>

        <rich:dataTable value="#{kalipHome.kalipAltKalipList}"
                       var="_kalipaltkalip"
                  rendered="#{not empty kalipHome.kalipAltKalipList}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="kalipAltKalipListTable">
            <rich:column sortBy="#{_kalipaltkalip.id}">
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_kalipaltkalip.id}"/>
            </rich:column>
            <rich:column sortBy="#{_kalipaltkalip.altkalipadet}">
                <f:facet name="header">Altkalipadet</f:facet>
                <h:outputText value="#{_kalipaltkalip.altkalipadet}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectkalipaltkalip"
                     value="Select"
                      view="/Kalipaltkalip.xhtml">
                    <f:param name="kalipaltkalipId"
                            value="#{_kalipaltkalip.id}"/>
                    <f:param name="kalipaltkalipFrom" value="Kalip"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add kalipaltkalip"
                view="/KalipaltkalipEdit.xhtml">
            <f:param name="kalipId"
                    value="#{kalipHome.instance.id}"/>
            <f:param name="kalipaltkalipFrom" value="Kalip"/>
        </s:button>
    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
